From 014723d9b3275d1b840118331fe198e29254d8fa Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Fri, 9 Dec 2016 11:52:09 -0800 Subject: [PATCH] fix potential int overflow in efi/boot HorizontalResolution and VerticalResolution are 32bit, while size is 64bit. As it stands multiplications are evaluated with 32bit arithmetic, which could overflow. Cast HorizontalResolution to 64bit to avoid that. Coverity-ID: 1381858 Signed-off-by: Stefano Stabellini Acked-by: Jan Beulich --- xen/common/efi/boot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 56544dcb66..3e5e4ab0e9 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -684,10 +684,10 @@ static UINTN __init efi_find_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, break; } if ( !cols && !rows && - mode_info->HorizontalResolution * + (UINTN)mode_info->HorizontalResolution * mode_info->VerticalResolution > size ) { - size = mode_info->HorizontalResolution * + size = (UINTN)mode_info->HorizontalResolution * mode_info->VerticalResolution; gop_mode = i; } -- 2.30.2